<?php

// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库：https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库：https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------

namespace app\store\controller;

use library\Controller;
use think\Db;

/**
 * 会员信息管理
 * Class Member
 * @package app\store\controller
 */
class Member extends Controller
{
    /**
     * 绑定数据表
     * @var string
     */
    protected $table = 'StoreMember';

    /**
     * 会员信息管理
     * @auth true
     * @menu true
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * @throws \think\exception\PDOException
     */
    public function index()
    {
        $this->title = '会员信息管理';
        $dbconf = $this->getconfig('vister_db');
        $query = $this->_query(Db::connect($dbconf)->table('store_member'))->like('nickname,phone')->equal('vip_level');
        $query->dateBetween('create_at')->order('id desc')->page();


//         $where = '';

//         var_dump($this->request->param(''));
// $search[0] ='';

//         foreach ($search as $key => $value) {
//             # code...
//             if($value){
//                 $where=$where.$value.' and ';
//             }
//         }
//         $where=substr($where,0,strlen($where)-5);

//         $offset = trim($this->request->param('offset'))?:0;
//         $length = trim($this->request->param('length'))?:10;

//         $dbconf = $this->getconfig('vister_db');

//         $res = Db::connect($dbconf)->table('view_memeber_user')->where($where)->limit($offset, $length)->select();
//         $res = Db::connect($dbconf)->table('view_memeber_user')->where($where)->paginate($length);
//         $page = $res->render();
//         $count = Db::connect($dbconf)->table('view_memeber_user')->where($where)->count();

//         $pagehtml = $this->pagenew($res, $page = true,$count, $limit = 0,$offset,$length);


//         return $this->fetch('index',[
//             'list'=>$res,
//             'pagehtml'=>$pagehtml
//         ]);
    }

}
